#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define BUFSIZE 8192
int main(int argc, char *argv[])
{
	char buf[BUFSIZE];
	int ch;
	FILE *fp;
	fp = fopen("w", "w+");
	if(fp == NULL)
	{
		perror(argv[0]);
		exit(1);
	}
	//fwrite("sss", 1, 3, fp);
	//fgets(buf,BUFSIZE, stdin);
	//fwrite(buf, 1, BUFSIZE, fp);
	while((ch=fgetc(stdin)) != 'A')
	{
		fflush (fp); 
		ch = putc(ch, fp);
	}
	fclose(fp);
}
